//
//  MOAddWokTaskViewController.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/8/12.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOAddWokTaskViewController.h"

@interface MOAddWokTaskViewController ()<UITableViewDelegate,UITableViewDataSource>

@property(nonatomic,strong)UIView *workTargetView;

@property(nonatomic,strong)UIView *workContentView;

@property(nonatomic,strong)UITextView *workTargetTextView;

@property(nonatomic,strong)UITextView *workContentTextView;

@property(nonatomic,strong)UIView *headerView;

@property(nonatomic,strong)UITableView *tableView;

@property(nonatomic,strong)UIView *bottomView;

@end

@implementation MOAddWokTaskViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self creatView];
    
    [self initData];
}

-(void)creatView
{
    self.title = @"添加工作任务";
    
    self.view.backgroundColor = KGrayColor_ededed;
    
    [self.headerView addSubview:self.workTargetView];
    
    [self.headerView addSubview:self.workContentView];
    
    [self.view addSubview:self.tableView];
    
    self.tableView.tableHeaderView = self.headerView;
    
    [self.view addSubview:self.bottomView];
    
}

-(void)initData
{
    
}


#pragma mark -- 保存
-(void)clickSaveButton
{
    
}

#pragma mark -- UITableViewDelegate,UITableViewDataSource
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 2;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleValue1) reuseIdentifier:@"cell"];
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
    cell.detailTextLabel.font = FONT_SIZE(15);
    cell.textLabel.textColor = KBlackColor_2A2A2A;
    NSArray *arr = @[@"任务类型",@"时限类型"];
    NSArray *ar1 = @[@"请选择任务类型",@"请选择时限类型"];
    cell.textLabel.text = arr[indexPath.row];
    cell.detailTextLabel.text = ar1[indexPath.row];
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kWConversions(53);
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 10;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.00001;
}

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    return nil;
}

-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
{
    return nil;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0) {
        SNXYSelectedNumberView *pickview = [[SNXYSelectedNumberView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        NSArray *tArr = @[@"税收任务",@"增值税任务",@"企业所得税任务",@"个人所得税任务",@"税务会计任务"];
        pickview.numberArray = tArr;
        __weak typeof (self)weakSelf = self;
        pickview.clickIndexBlock = ^(NSInteger index) {
            
        };
        [WINDOW addSubview:pickview];
    }else{
        SNXYSelectedNumberView *pickview = [[SNXYSelectedNumberView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
        NSArray *tArr = @[@"税收任务",@"增值税任务",@"企业所得税任务",@"个人所得税任务",@"税务会计任务"];
        pickview.numberArray = tArr;
        __weak typeof (self)weakSelf = self;
        pickview.clickIndexBlock = ^(NSInteger index) {
            
        };
        [WINDOW addSubview:pickview];
    }
}

#pragma mark --
-(UIView *)bottomView
{
    if (!_bottomView) {
        _bottomView = [[UIView alloc]initWithFrame:CGRectMake(0, SCREEN_HEIGHT - StatusBarAndNavigationBarHeight - 57, SCREEN_WIDTH, 57)];
        _bottomView.backgroundColor = KWhiteColor;
        
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 57)];
        [button setTitle:@"保存" forState:UIControlStateNormal];
        button.titleLabel.font = FONT_SIZE(15);
        [button setTitleColor:KBlueColor_2C94FF forState:UIControlStateNormal];
        [button addTarget:self action:@selector(clickSaveButton) forControlEvents:UIControlEventTouchUpInside];
        [_bottomView addSubview:button];
        
    }
    return _bottomView;
}

-(UIView *)headerView
{
    if (!_headerView) {
        _headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, kWConversions(138) * 2 + kWConversions(21))];
        _headerView.backgroundColor = KGrayColor_ededed;
        
        [_headerView addSubview:self.workTargetView];
        
        [_headerView addSubview:self.workContentView];
    }
    return _headerView;
}

-(UIView *)workTargetView
{
    if (!_workTargetView) {
        _workTargetView = [[UIView alloc]initWithFrame:CGRectMake(0, 10, SCREEN_WIDTH, kWConversions(138))];
        _workTargetView.backgroundColor = KWhiteColor;
        
        UILabel *targetLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, 100, 15)];
        targetLabel.font = FONT_SIZE(15);
        targetLabel.textColor = KBlackColor_2A2A2A;
        targetLabel.text = @"工作目标";
        [_workTargetView addSubview:targetLabel];
        
        self.workTargetTextView = [[UITextView alloc]initWithFrame:CGRectMake(20, targetLabel.bottom + 12, SCREEN_WIDTH, ceil(_workTargetView.height - 20 - 12 - targetLabel.height))];
        self.workTargetTextView.textColor = KBlackColor_2A2A2A;
        self.workTargetTextView.placeholder = @"请输入工作目标...";
        self.workTargetTextView.font = FONT_SIZE(15);
        self.workTargetTextView.placeholdFont = FONT_SIZE(15);
        [_workTargetView addSubview:self.workTargetTextView];
        
    }
    return _workTargetView;
}

-(UIView *)workContentView
{
    if (!_workContentView) {
        _workContentView = [[UIView alloc]initWithFrame:CGRectMake(0, self.workTargetView.bottom + 1, SCREEN_WIDTH, kWConversions(138))];
        _workContentView.backgroundColor = KWhiteColor;
        
        UILabel *targetLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 20, SCREEN_WIDTH - 40, 15)];
        targetLabel.font = FONT_SIZE(15);
        targetLabel.textColor = KBlackColor_2A2A2A;
        targetLabel.text = @"工作内容及考核标准:";
        [_workContentView addSubview:targetLabel];
        
        self.workContentTextView = [[UITextView alloc]initWithFrame:CGRectMake(20, targetLabel.bottom + 12, SCREEN_WIDTH, ceil(_workTargetView.height - 20 - 12 - targetLabel.height))];
        self.workContentTextView.textColor = KBlackColor_2A2A2A;
        self.workContentTextView.placeholder = @"请输入工作内容及考核标准...";
        self.workContentTextView.font = FONT_SIZE(15);
        self.workContentTextView.placeholdFont = FONT_SIZE(15);
        [_workContentView addSubview:self.workContentTextView];
        
    }
    return _workContentView;
}


-(UITableView *)tableView
{
    if (!_tableView) {
        
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-StatusBarAndNavigationBarHeight - 57) style:UITableViewStyleGrouped];
        _tableView.delegate = self;
        _tableView.dataSource = self;
        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
        _tableView.backgroundColor = KGrayColor_ededed;
        _tableView.showsVerticalScrollIndicator = NO;
        
    }
    return _tableView;
}






















@end
